<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>

</body>
<script>

    // var p = new Promise(function (resolve, reject) {
    //     resolve(1);
    // })
    // console.log(p); // {<fulfilled:1>}

    // Promise.myResolve = function (arg) {
    //     var p = new Promise(function (resolve, reject) {
    //         resolve(arg);
    //     })
    //     return p;   // {<fulfilled:arg>}
    // }




    // Promise.resolve()
    // 1. 可以根据传入的参数,快速得到 已成功 状态的Promise对象 (前提: 参数不是Promise对象)
    // 2. 如果传入的参数是一个Promise对象   => 不做任何操作  =>直接返回该Promise对象

    // var p = Promise.resolve(1);
    // console.log(p); // {<fulfilled:1>}

    // var p1 = Promise.resolve(p);
    // console.log(p1);
    // console.log(p1 === p);  // true


    var p = new Promise(function (resolve, reject) {
        reject(1);
    })
    console.log(p);

    var p1 = Promise.resolve(p);
    console.log(p1);
    console.log(p === p1);









</script>

</html>